package com.yanqu.road.server.cmd.monopolymarket.resgrab;

import com.yanqu.road.pb.monopolymarket.MonopolyMarketProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.monopolymarket.MonopolyMarketResGrabMgr;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;
import com.yanqu.road.server.protocol.Protocol;

import java.util.List;

/**
 * @Description
 * @Author cwq
 * @Data 2021/8/12 17:08
 */
@Cmd(code = Protocol.C_CROSS_MONOPOLY_MARKET_RES_GRAB_GET_POINT_REWARD, desc = "批量领取资源点奖励")
public class CrossMonopolyMarketResGrabGetPointRewardCmd extends CrossCommand {

    long userId;
    List<MonopolyMarketProto.MonopolyMarketGetPointRewardTemp> list = null;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        userId = packet.getPlayerId();
        MonopolyMarketProto.MonopolyMarketGetPointRewardReqMsg req = MonopolyMarketProto.MonopolyMarketGetPointRewardReqMsg.parseFrom(packet.getBytes());
        list = req.getGetListList();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MessageHelper.sendPacket(serverId, userId , YanQuMessageUtils.buildMessage(GameProtocol.S_MONOPOLY_MARKET_RES_GRAB_GET_POINT_REWARD_FROM_CROSS, MonopolyMarketResGrabMgr.getPointReward(userId,serverId,list)));
    }

    @Override
    public void sendData() {

    }
}
